It is known in the machine vision industry how to search for an object of a known size and shape in an image. Such techniques are used to align a template of the object with the image of the object so that further processes can inspect portions of the object, such as printing on the surface of the object, roundness of the object, or the presence/absence of a pill contained in the object.
Here, an image is a rectangular, two-dimensional array of grey values, where each element in the array is called a pixel. A template is similar to an image, except that it need not be rectangular, or even simply connected, i.e. it may consist of a collection of disjoint regions. A template is similar to an image also in that each element of the template is assigned a grey value.
In general, the methodology for searching for an object of known size and shape in an image is to first construct the template of the object; then search a likely area of the image of the object for the portion of the image to which the template is most similar. Various methods, such as that taught in U.S. Pat. No. 5,548,326 Efficient Image Registration, have been developed to improve the efficiency of such searches.
Once the object is found, it can be said to be aligned with respect to the template. Alignment shall be defined as orienting the object with respect to the template to make at least one alignment parameter of the object, such as the planar position, substantially equal to the corresponding alignment parameter of the template. After alignment, commonly, the machine vision system returns a metric representative of the goodness of fit, a measure of the aggregate deviations of the actual object from the template.
However, when the size of the object to be found is unknown, the known search techniques have had to be modified to include multiple templates of various sizes. Multiple templates are needed because typically such techniques search for objects that are the same size as the template. The techniques typically compare pixels of the image to elements of the template for a match. Thus, the pixel values of the image and the elements of the template will not correspond unless an appropriately scaled template with appropriate number and arrangement of elements is used. However, it is not always possible to know which sizes of the template are required for effective searching.
The possibility of flaws in the object further diminishes the usefulness of current search techniques for objects of an unknown size. Under such circumstances, known techniques take an unacceptably long time. Further, even when given a longer time to search, known techniques have difficulty distinguishing between a perfect but differently sized object, and a flawed but correctly sized object.